/**
 * 字典数据
 */
import { IsDefined, IsInt, IsNotEmpty, IsString, Length } from "class-validator";
import { BaseEntity } from "../BaseEntity";
import { TStatus } from "../../types/CommonType";
import { Model } from "sequelize";

export default class SysDictEntity extends BaseEntity {
  public typeId?: string;
  public id?: number;

  public dictType: string;

  @Length(1, 20)
  @IsString()
  @IsNotEmpty()
  @IsDefined()
  public dictLabel: string;

  @Length(1, 20)
  @IsString()
  @IsNotEmpty()
  @IsDefined()
  public dictValue: string;

  @IsInt()
  @IsNotEmpty()
  @IsDefined()
  public dictSort: number;

  @IsString()
  public classType: string;

  @IsString()
  public listClass: string;

  @IsString()
  public isDefault: string;

  @IsString()
  @IsNotEmpty()
  @IsDefined()
  public status: TStatus;

  @Length(1, 20)
  @IsString()
  public remark: string;

  public static transform(plainObject: object): SysDictEntity {
    return super.baseTransform(SysDictEntity, plainObject);
  }
}

export interface ISysDictDataModel extends Model<SysDictEntity> {}
